import request from '@/utils/request'

const BASE_URL = process.env.VUE_APP_BASE_URL
//登录
export function login(data) {
  return request({
    url: `${BASE_URL}/web/common/login`,
    method: 'post',
    data
  })
}
//退出
export function logout() {
  return request({
    url: `${BASE_URL}/user/logout`,
    method: 'post'
  })
}
//用户列表
export function pageUser(params) {
  return request({
    url: `${BASE_URL}/web/v1/admin/adminList`,
    method: 'get',
    params: params
  })
}
//用户详情
export function getUserDetail(id) {
  return request({
    url: `${BASE_URL}/web/v1/admin/getInfo/`+id,
    method: 'get',
  })
}
//新增用户
export function insertUser(data) {
  return request({
    url: `${BASE_URL}/web/v1/admin/addUser`,
    method: 'post',
    data
  })
}
//修改用户
export function updateUser(data) {
  return request({
    url: `${BASE_URL}/web/v1/admin/updateUser`,
    method: 'post',
    data
  })
}
//删除用户
export function delUser(id) {
  return request({
    url: `${BASE_URL}/web/v1/admin/delUser/`+id,
    method: 'post',
  })
}
//菜单导航
export function nav() {
  return request({
    url: `${BASE_URL}/web/v1/admin/nav`,
    method: 'get',
  })
}